function siteNav() {
    var navMain = document.getElementById('navMain')
    console.log(navMain);

    function navAjax() {
        ajax({
            url: "http://chst.vip:1234/api/getsitenav?key=all",
            success(res) {
                this.data = res.result;
                let html = renderNav(data);
                navMain.innerHTML = html;
            }
        })

    }

    navAjax()


    function renderNav(arr) {
        let html = '';
        arr.forEach(item => {
            html += `
            <a href="${item.navHref}">
            <img src="${item.navImg}">
                
            </img>
                <p>${item.navTitle}</p>
            </a>`
                // console.log(src);
        });
        return html;
    }
}
siteNav()